import { createRouter, createWebHistory } from 'vue-router'
import admin from '@/views/admin/layout.vue'
import adminuser from '@/views/admin/user.vue'
import adminchanpin from '@/views/admin/chanpin.vue'
import adminjilv from '@/views/admin/jilv.vue'
import adminkechen from '@/views/admin/kechen.vue'
import adminpinjia from '@/views/admin/pinjia.vue'
import adminshequ from '@/views/admin/shequ.vue'
import adminstudent from '@/views/admin/student.vue'
import adminteacher from '@/views/admin/teacher.vue'

import index from '@/views/index/layout.vue'
import indexkechen from '@/views/index/kechen.vue'
import indexchanpin from '@/views/index/chanpin.vue'
import indexjilv from '@/views/index/jilv.vue'
import indexorder from '@/views/index/order.vue'
import indexstujilv from '@/views/index/stujilv.vue'
import indexuser from '@/views/index/user.vue'

import login from '@/views/login.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'admin',
      component: admin,
      redirect: '/adminuser',
      children:[
        {
          path: '/adminuser',
          name: 'adminuser',
          component: adminuser,
        },
        {
          path: '/adminchanpin',
          name: 'adminchanpin',
          component: adminchanpin,
        },
        {
          path: '/adminjilv',
          name: 'adminjilv',
          component: adminjilv,
        },
        {
          path: '/adminkechen',
          name: 'adminkechen',
          component: adminkechen,
        },
        {
          path: '/adminpinjia',
          name: 'adminpinjia',
          component: adminpinjia,
        },
        {
          path: '/adminshequ',
          name: 'adminshequ',
          component: adminshequ,
        },
        {
          path: '/adminstudent',
          name: 'adminstudent',
          component: adminstudent,
        },
        {
          path: '/adminteacher',
          name: 'adminteacher',
          component: adminteacher,
        }
      ]
    },
    {
      path: '/index',
      name: 'index',
      component: index,
      redirect: '/indexkechen',
      children:[
        {
          path: '/indexkechen',
          name: 'indexkechen',
          component: indexkechen,
        },{
          path: '/indexchanpin',
          name: 'indexchanpin',
          component: indexchanpin,
        },{
          path: '/indexjilv',
          name: 'indexjilv',
          component: indexjilv,
        },{
          path: '/indexorder',
          name: 'indexorder',
          component: indexorder,
        },{
          path: '/indexstujilv',
          name: 'indexstujilv',
          component: indexstujilv,
        },{
          path: '/indexuser',
          name: 'indexuser',
          component: indexuser,
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: login,
    }
    
  ],
})

export default router
